//
//  BKRealAuthFailReasonView.m
//  bestkeep
//
//  Created by windCould on 16/11/30.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKRealAuthFailReasonView.h"
#import "BKMyCommon.h"
@interface BKRealAuthFailReasonView ()

@property (nonatomic,strong)UILabel * realNameAuthFailReasonLab;


@end


@implementation BKRealAuthFailReasonView


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = RGBCOLOR(242, 242, 242, 1);
        [self setUpViews];
    }
    
    return  self;
}

-(void)setUpViews{
    
    _realNameAuthFailReasonLab =[[UILabel alloc]initWithFrame:CGRectZero];
    _realNameAuthFailReasonLab.numberOfLines = 0;
    _realNameAuthFailReasonLab.font = [UIFont systemFontOfSize:10];
    _realNameAuthFailReasonLab.textColor = RGBCOLOR(136, 136, 136, 1);
    [self addSubview:_realNameAuthFailReasonLab];
    
    NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc]init];
    paragraph.lineHeightMultiple = 1.0;
    paragraph.lineSpacing = 3;
    paragraph.paragraphSpacing = 3;
    paragraph.alignment = NSTextAlignmentLeft;
    NSString *str = @"为什么需要实名认证? \n根据海关规定，购买跨境商品需要办理清关手续，请您配合进行实名认证，以确保您购买的商品顺利通过海关检查。\n实名认证规则：购买跨境商品需要填写BESTKEEP账号注册人的真实姓名及身份证号码，部分商品下单时需要提供收货人的真实姓名（含身份证照片），具体以下单时的提示为准。";
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:12],NSParagraphStyleAttributeName:paragraph};
    
    NSMutableAttributedString * mutStr = [[NSMutableAttributedString alloc]initWithString:str attributes:dic];
    [mutStr addAttribute:NSForegroundColorAttributeName value:RGBCOLOR(136, 136, 136, 1) range:NSMakeRange(10, 25)];
    [mutStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:NSMakeRange(0, 10)];
    
    _realNameAuthFailReasonLab.attributedText = mutStr;
    [_realNameAuthFailReasonLab sizeToFit];
    [self addSubview:_realNameAuthFailReasonLab];
    
    [self layoutViews];
   
}

-(void)layoutViews{
    
    [_realNameAuthFailReasonLab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.mas_top).offset(10);
        make.left.mas_equalTo(self.mas_left).offset(ApplicationBackGauge);
        make.right.mas_equalTo(self.mas_right).offset(-ApplicationBackGauge);
    }];
}





@end
